package com.jia.together.controller.front;

import com.jia.together.entity.MemberComment;
import com.jia.together.service.MemberCommentService;
import com.jia.together.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.Map;

@RestController
@RequestMapping("/front/memberComment")
//@CrossOrigin
public class MemberCommentFrontController {

    @Autowired
    private MemberCommentService memberCommentService;

    @GetMapping("/list")
    public R list(@RequestParam(required = false) String blogId,@RequestParam(required = false) String courseId,@RequestParam Long pageNum,@RequestParam Long pageSize){
        Map<String,Object> map = memberCommentService.selectListByBlogId(courseId,blogId,pageNum,pageSize);
        return R.ok().data(map);
    }
    @PostMapping("/add")
    public R add(@RequestBody MemberComment memberComment){
        memberCommentService.save(memberComment);
        return R.ok();
    }
}
